package offer;

public class Offer50 {
    class Solution {
        public char firstUniqChar(String s) {
            int[] dict = new int[26];
            int length = s.length();
            for (int i = 0; i < length; i++) {
                int index = s.charAt(i) - 'a';
                dict[index] += 1;
            }

            for (int i = 0; i <26; i++) {
                if (dict[i]==1){
                    return (char) (dict[i]+'a');
                }
            }

            return ' ';
        }
    }
}
